-content_for :modal_title do
  -if f.object.new_record?
    Create New Audit Cycle
  -else
    Edit Audit Cycle

-if !f.object.new_record?
  -content_for :modal_delete_path, delete_flow_cycle_path(f.object)

-if params[:program_id].present?
  -program = Program.where(:id => params[:program_id]).first
-else
  -program = f.object.program

-if program.present?
  =f.hidden_field :program_id, :value => program.id
-else
  .row-fluid
    =wrapped_select(f, :span6, :program_id, Program.all.map { |p| [p.display_name, p.id] }, :class => :collection, :multiple => false)

.row-fluid
  =wrapped_text_field f, :span4, :title, :placeholder => 'Enter title', :label_name => 'Audit Title <span class="required">*</span>'.html_safe, :value => f.object.title.presence || generate_default_title_for_cycle(program)
  =wrapped_text_field f, :span4, :audit_firm, :placeholder => '', :label_name => 'Audit Firm'
  =wrapped_text_field f, :span4, :audit_lead, :placeholder => '', :label_name => 'Audit Lead'
.row-fluid
  =wrapped_date_field f, :span4, :start_at, :class => 'date', :label_name => 'Audit Start Date', :placeholder => 'MM/DD/YYYY', :value => f.object.start_at.present? ? f.object.start_at.strftime('%m/%d/%Y') : Time.zone.now.strftime('%m/%d/%Y')
  =wrapped_date_field f, :span4, :end_at, :class => 'date', :label_name => 'Audit End Date', :placeholder => 'MM/DD/YYYY', :value => f.object.end_at.present? ? f.object.end_at.strftime('%m/%d/%Y') : nil
  =wrapped_date_field f, :span4, :report_due_at, :class => 'date', :label_name => 'Report Due Date', :placeholder => 'MM/DD/YYYY', :value => f.object.report_due_at.present? ? f.object.report_due_at.strftime('%m/%d/%Y') : nil
.row-fluid
  .span4 &nbsp;
  .span8
    =f.label :complete
    =f.check_box :complete, :class => :check_box
    %span.description Was this audit cycle completed?

.row-fluid
  =wrapped_text_area f, :span12, :description, :class => 'double wysihtml5', :placeholder => 'Enter description here', :label_name => 'Description (Optional)', :wrapper_div_class => 'wysiwyg-area'

%br

=render :partial => "shared/wysihtml5"
